﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using TaoSH.AppCode;

namespace TaoSH.View
{
    public partial class BranchMangerOLD : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = GetChiMenuByUserName(1);
            string s = str;
        }

        /// <summary>
        /// 根据用户名，父菜单代码获取用户可以查看的子菜单
        /// </summary>
        /// <param name="strUserName">用户代码</param>
        /// <param name="intPMenuCode">父菜单代码</param>
        /// <returns></returns>
        public string GetChiMenuByUserName(int intBranchCode)
        {
            StringBuilder strMainMenu = new StringBuilder();
            var q = new JH_Auth_BranchB().GetEntities("DeptRoot='" + intBranchCode + "'").ToList();
            if (q.Count > 0)
            {
                strMainMenu.Append("<ul>");
                foreach (var item in q)
                {
                    strMainMenu.Append("<li  id='" + item.DeptCode + "' chargename='" + item.Remark1+ "'>" + item.DeptName + GetChiMenuByUserName(item.DeptCode) + "</li>");
                }
                strMainMenu.Append("</ul>");

            }
            return strMainMenu.Length > 0 ? strMainMenu.ToString() : "";
        }

        protected void btndelJG_Click(object sender, EventArgs e)
        {
            int intBranchCode = int.Parse(hidseljgid.Value);
            new JH_Auth_BranchB().DelBranchByCode(intBranchCode);
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>MyDialog.alertTip('删除成功');</script>");

        }

    }
}